package com.spider.constructor;
//注意：构造器的名称必须与类名一致；类里面默认提供一个无参构造器；所以创建构造器时要创建一个无参构造器。
public class Student {
    String name;
    int age;
    String sex;
    //1.无参数构造器
    public Student (){
        System.out.println("无参数构造器");
    }
    //2.有参数构造器
    public Student (String name,int age) {
        System.out.println("有参数构造器");
    }
    public Student (String n,int a,String s) {
        name = n;
        age = a;
        sex = s;
    }
}
